// 小猫kitty
// 把kitty对象的地址传递给一个函数

#include <iostream>
#include <string.h>
using namespace std;

class Kitty {
private:
    char breed[40];
    char name[40];
    int cost;

public:
    Kitty();
    void PutBreed(char breed[]) { strcpy(this->breed, breed); }
    void PutName(char name[]) { strcpy(this->name, name); }
    void PutCost(int cost) { this->cost = cost; }
    void PrintCatInfo();
};

void FillCatInfo(Kitty* kitty);

int main() {
    Kitty kitty;
    cout << "Kitty程序\n"
        << "在调用程序以前:\n";
    kitty.PrintCatInfo();

    FillCatInfo(&kitty);

    cout << "在调用程序以后:\n";
    kitty.PrintCatInfo();
    cout << "结束\n";
}

Kitty::Kitty() {
    strcpy(breed, "未知");
    strcpy(name, "未命名");
    cost = 0;
}

void Kitty::PrintCatInfo() {
    cout << "品种" << breed << "\n"
        << "名字" << name << "\n"
        << "价格 $" << cost << "\n";
}

void FillCatInfo(Kitty* kitty) {
    char breed[40] = "Alley";
    char name[40] = "Thomas";
    int cost = 3;

    kitty->PutBreed(breed);
    kitty->PutName(name);
    kitty->PutCost(cost);
}